function removeDuplicates(str: string): string {
    let arr = ''
    let newstr = str.split('')
    for (let i = 0; i < newstr.length; i++) {
        if (newstr[i] === newstr[i + 1]) {
            newstr.splice(i, 1)
        } else {
            arr += newstr[i]
        }
    }
    return arr
}
console.log(removeDuplicates("aaddukcaac"))


function reformatNumber(str: string): string {
    let newStr: string = ''
    let newarr = ['1', '2', '3', '4']
    let str2: string = ''
    let start: number = 0
    let end: number = 0
    for (let index = 0; index < str.length; index++) {
        for (let i = 0; i < newarr.length; i++) {
            if (str[index] === newarr[i]) {
                newStr += str[index]
            }
        }
    }
    console.log(newStr, "newStr");
    for (let i = 0; i < newarr.length; i++) {
        if (i % 3 == 0 && i != 0) {
            end = i;
            str2 += newStr.slice(start, end) + '-'
            start = end
        }
    }
    return str2
}
console.log(removeDuplicates('1-23 345 8989'));
